package com.huika.dealontop.control.homepage.utils.fourad;

import android.app.Activity;
import android.view.View;

import com.huika.dealontop.GlobalApp;
import com.huika.dealontop.R;
import com.huika.dealontop.control.homepage.utils.fourad.basefourad.BaseFourAd;
import com.huika.dealontop.support.domain.HomePageAdvertisementSeatInfo;

import java.util.ArrayList;

;
;

/**
 * Created by cailu on 2016/1/13.
 */
public class FourAd extends BaseFourAd {

    private View mView;


    public FourAd(Activity context, ArrayList<HomePageAdvertisementSeatInfo> info) {
        super(context, info);
    }

    @Override
    protected void initWidget() {
        initHomePageFourAdvertisementDatas();
    }

    @Override
    protected void widgetClick(View v) {

    }

    @Override
    protected View initRoot() {
        mView = View.inflate(mContext, R.layout.item_fourad, null);
        return mView;
    }


    public View getAdView() {
        return mView;
    }

    private void initHomePageFourAdvertisementDatas() {
        //int widthPixel = mWidthPixels - UIUtils.dip2px(1);
        int width = (int) (mWidthPixels / 2.0);

        setLayoutParamsHW(mAdvertisementOne, width, (int) (width / 320.0 * 284));

        setLayoutParamsHW(mAdvertisementTwo, width, (int) (width / 320.0 * 142));

        setLayoutParamsHW(mAdvertisementThree,width, (int) (width /320.0*142));

        setLayoutParamsHW(mAdvertisementFour, mWidthPixels, (int) (mWidthPixels / 640.0 * 128));

        GlobalApp.loadImg(mAdvertisementFour, mHomePageFourAdvertisementLists.get(3).getAdPic());

        GlobalApp.loadImg(mAdvertisementThree, mHomePageFourAdvertisementLists.get(2).getAdPic());

        GlobalApp.loadImg(mAdvertisementTwo, mHomePageFourAdvertisementLists.get(1).getAdPic());

        GlobalApp.loadImg(mAdvertisementOne, mHomePageFourAdvertisementLists.get(0).getAdPic());



    }
}
